﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;

using NCT.Framework;
using VISS.API.Users;
using VISS.API.Commons;
using VISS.API.Events;

using VISS.MailImpl;
using NCT.Mail;


namespace AppConsoleTest {
    class Program {

        static IUser _objectUser = StructureMapFactory.GetInstance<IUser>();
        static IUserAdmin _objectUserAdmin = StructureMapFactory.GetInstance<IUserAdmin>();
        static IUserGeneralProfile _objectGeneralProfile = StructureMapFactory.GetInstance<IUserGeneralProfile>();
        static IUserGeneralProfileAdmin _objectGeneralProfileAdmin = StructureMapFactory.GetInstance<IUserGeneralProfileAdmin>();
        static IUserContactInfo _objectContactInfo = StructureMapFactory.GetInstance<IUserContactInfo>();
        static IUserContactRequest _objectContactRequest = StructureMapFactory.GetInstance<IUserContactRequest>();
        static IUserAppearanceProfile _objectApperanceProfile = StructureMapFactory.GetInstance<IUserAppearanceProfile>();
        static IUserFamilyProfile _objFamilyProfile = StructureMapFactory.GetInstance<IUserFamilyProfile>();
        static IUserCultureProfile _objCultureProfile = StructureMapFactory.GetInstance<IUserCultureProfile>();
        static IUserLivingProfile _objLivingProfile = StructureMapFactory.GetInstance<IUserLivingProfile>();

        static IUserAvatar _objectAvatar = StructureMapFactory.GetInstance<IUserAvatar>();
        static IUserImage _objUserImage = StructureMapFactory.GetInstance<IUserImage>();

        static IUserMessage _objectMessage = StructureMapFactory.GetInstance<IUserMessage>();
        static IUserMessageAdmin _objectMessageAdmin = StructureMapFactory.GetInstance<IUserMessageAdmin>();

        static ICity _objectCity = StructureMapFactory.GetInstance<ICity>();
        static IJob _objJob = StructureMapFactory.GetInstance<IJob>();
        static IReligion _objReligion = StructureMapFactory.GetInstance<IReligion>();
        static IPropertyCategoryAdmin _objPropertyCategoryAdmin = StructureMapFactory.GetInstance<IPropertyCategoryAdmin>();
        static IPropertyCategory _objPropertyCategory = StructureMapFactory.GetInstance<IPropertyCategory>();
        static IPropertyAdmin _objPropertyAdmin = StructureMapFactory.GetInstance<IPropertyAdmin>();
        static IProperty _objProperty = StructureMapFactory.GetInstance<IProperty>();
        
        static IUserFollower _objUserFollower = StructureMapFactory.GetInstance<IUserFollower>();

        static void Main(string[] args) {
            //UserAdminEnt uitem = new UserAdminEnt();
            //UserEnt item = new UserEnt();
            //UserGeneralProfileEnt pItem = null;

            //item.UserKey = "chaA8PpNGow6hDG";
            //item.Email = "tranvantai2@yahoo.com";
            //uitem.Email = "tranvantai2@yahoo.com";
            //item.
            //item.Status = EUserStatus.Disabled;
            //_objectUserAdmin.DisableUser("chaA8PpNGow6hDG");
            //_objectUserAdmin.UnDisableUser("chaA8PpNGow6hDG");
            //_objectUserAdmin.DeleteUser("chaA8PpNGow6hDG");
            //_objectUserAdmin.UnDeleteUser("chaA8PpNGow6hDG");
            //_objectUserAdmin.VefifyUser("chaA8PpNGow6hDG");
            //_objectUserAdmin.Insert(uitem, null, null);
            //uitem = _objectUserAdmin.GetByUserKey_Admin("chaA8PpNGow6hDG");
            //uitem = _objectUserAdmin.GetByEmail("vandinhchuong@gmail.com");
            //long totalRecord = 0;
            //List<UserAdminEnt> result = _objectUserAdmin.GetWithConditionAndPaging(EUserGender.Male, EUserStatus.Unknown, 1, 10, out totalRecord);
            //_objectUserAdmin.UpdateStatus(item);

            //bool b = _objectUser.Insert(item, pItem);
            //EUserLoginResult result = _objectUser.Login("vandinhchuong@gmail.com", "123456", out item);
            //bool b = _objectUser.UpdateEmail(item);
            //item.Password = "trienthanh";
            //bool b = _objectUser.UpdatePassword(item);
            //item.SLink = "NgoThiThuHang";
            //item.SLinkExpiredDate = new DateTime(2012, 7, 6);
            //bool b = _objectUser.UpdateSLink_SLinkExpiredDate(item);
            //bool b = _objectUser.UpdateSLink(item);
            //bool b = _objectUser.UpdateSLinkExpiredDate(item);
            //item.Status = EUserStatus.Disabled;
            //_objectUser.UpdateStatus(item);
            //ECheckEmailResult check = _objectUser.CheckEmailExisted("vandinhchuong@yahoo.com");
            //item = _objectUser.GetByUserKey("chaA8PpNGow6hDG");
            //pItem  = _objectGeneralProfile.GetByUserKey(item.UserKey);
            //pItem  = _objectGeneralProfile.GetByUserKey("HnPyHD67F2Jdy6A");
            //pItem.Blast = "Tao là trùm";
            //_objectGeneralProfile.UpdateBlast(pItem.UserKey, pItem.Blast);
            //int archivePoint = 0;
            //int leftPoint = 0;
            //int imageCount = 0;
            //int trusted = 0;
            //_objectGeneralProfile.IncreaseArchivePoint(pItem.UserKey, 200, out archivePoint, out leftPoint);
            //_objectGeneralProfile.DecreaseArchivePoint(pItem.UserKey, 47, out archivePoint);
            //_objectGeneralProfile.DecreaseLeftPoint(item.UserKey, 53, out leftPoint);
            //_objectGeneralProfile.IncreaseImageCount(pItem.UserKey, 1000, out imageCount);
            //_objectGeneralProfile.DecreaseImageCount(pItem.UserKey, 150, out imageCount);
            //_objectGeneralProfile.IncreaseTrusted(pItem.UserKey, out trusted);
            //_objectGeneralProfile.DecreaseTrusted(pItem.UserKey, out trusted);
            //pItem.Hobby = "Ăn ngủ !!!!";
            //_objectGeneralProfile.Update(pItem);

            //UserSrhEnt srhEnt = new UserSrhEnt();
            //srhEnt.CityID = 58;
            //srhEnt.Gender = EUserGender.Male;
            //srhEnt.FromBirthDate = new DateTime(1980, 1, 1);
            //srhEnt.ToBirthDate = new DateTime(2000, 1, 1);
            //srhEnt.JobID = 1;

            //int totalRecord = 0;
            //List<UserSrhResEnt> result = _objectGeneralProfile.QuickSearch(srhEnt, 1, 40, out totalRecord);
            //Console.Write(totalRecord);
            
            //string p = StringUtils.DoMD5("123456");

            //MailEnt.MailRegisterSuccess ent = new MailEnt.MailRegisterSuccess();
            //ent.Subject = "Test Chơi";
            //ent.Email = "thanhtt@nct.vn";
            //ent.FullName = "Tạ Truyển Thanh";
            //ent.Password = "123456";
            //ent.UserKey = "34567895432rf";

            //MailEnt.MailInfo mailInfo = new MailEnt.MailInfo();
            //mailInfo.MailContent = SerializerUtils.JsonSerialize(ent);
            //mailInfo.SendMailType = ESendMailType.RegisterSuccess;

            //try {
            //    if (NCT.Mail.MailQueuePD.CreateInstance().AddToQueue(AppSettings.MailType, SerializerUtils.JsonSerialize(mailInfo)) <= 0) {
            //        LogUtils.Error("Sent mail:frontend.nhaccuatui.com: active user fail.");
            //    }
            //}
            //catch (Exception ex) {
            //    LogUtils.Error("Sent mail fail: " + ex.ToString());
            //}
            //UserApperanceProfileEnt aItem = new UserApperanceProfileEnt();
            //aItem.UserKey = "chaA8PpNGow6hDG";
            //aItem.Height = 160;
            //aItem.Weight = 55;
            

            //_objectApperanceProfile.Insert(aItem);
            //_objectApperanceProfile.Update(aItem);
            //aItem = _objectApperanceProfile.GetByUserKey("ZAOMZnTRCSniCPz");

            //UserContactInfoEnt cItem = new UserContactInfoEnt();
            //cItem.UserKey = "ZAOMZnTRCSniCPz";
            //cItem.MobiPhone = "123456789";
            //_objectContactInfo.Update(cItem);
            //cItem = _objectContactInfo.GetByUserKey("ZAOMZnTRCSniCPz");

            //_objectContactRequest.SendViewContacInfoRequest("ExiDcmIYY8l8gSp", "sXZnDSH8Lp3HJtR");
            //_objectContactRequest.AllowRequest("sXZnDSH8Lp3HJtR", "ExiDcmIYY8l8gSp");
            //_objectContactRequest.DenyRequest("ExiDcmIYY8l8gSp", "sXZnDSH8Lp3HJtR");
            //_objectContactRequest.RemoveUserFromAllowedList("sXZnDSH8Lp3HJtR", "ExiDcmIYY8l8gSp");
            //int totalRecord = 0;
            //_objectContactRequest.GetRequestingListPaging("BHQVNT5Ey7o3pAh", 1, 10, out totalRecord);
            //_objectContactRequest.GetAllowedListPaging("sXZnDSH8Lp3HJtR", 1, 10, out totalRecord);

            //MailImpl impl = new MailImpl();

            //MailMsgEnt ent = impl.BuildMessageEnt("{\"SendMailType\":0,\"MailContent\":\"{\\\"UserKey\\\":\\\"mh6UAgg16vbQAxb\\\",\\\"FullName\\\":\\\"tàn w32\\\",\\\"Email\\\":\\\"aaa@dsgf.sdf\\\",\\\"Password\\\":\\\"isDXkk\\\",\\\"Subject\\\":\\\"VISS - Thư kích hoạt tài khoản\\\"}\"}");
            //MailMsgEnt ent = impl.BuildMessageEnt("{\"SendMailType\":2,\"MailContent\":\"{\\\"UserKey\\\":\\\"mh6UAgg16vbQAxb\\\",\\\"FullName\\\":\\\"tàn w32\\\",\\\"Email\\\":\\\"aaa@dsgf.sdf\\\",\\\"Subject\\\":\\\"VISS - Thư kích hoạt tài khoản\\\"}\"}");
            //MailMsgEnt ent = impl.BuildMessageEnt("{\"SendMailType\":3,\"MailContent\":\"{\\\"UserKey\\\":\\\"mh6UAgg16vbQAxb\\\",\\\"FullName\\\":\\\"tàn w32\\\",\\\"Email\\\":\\\"aaa@dsgf.sdf\\\",\\\"Subject\\\":\\\"VISS - Thư kích hoạt tài khoản\\\"}\"}");
            //MailMsgEnt ent = impl.BuildMessageEnt("{\"SendMailType\":4,\"MailContent\":\"{\\\"UserKey\\\":\\\"mh6UAgg16vbQAxb\\\",\\\"FullName\\\":\\\"tàn w32\\\",\\\"Email\\\":\\\"aaa@dsgf.sdf\\\",\\\"Subject\\\":\\\"VISS - Thư kích hoạt tài khoản\\\",\\\"MessagesInDay\\\":\\\"10\\\"}\"}");
            //MailMsgEnt ent = impl.BuildMessageEnt("{\"SendMailType\":1,\"MailContent\":\"{\\\"UserKey\\\":\\\"\\\",\\\"FullName\\\":\\\"tàn w32\\\",\\\"Email\\\":\\\"aaa@dsgf.sdf\\\",\\\"Subject\\\":\\\"VISS - Thư kích hoạt tài khoản\\\",\\\"Title\\\":\\\"Truyện tình mùa đông\\\",\\\"Content\\\":\\\"Tào lao bí đao\\\"}\"}");
            //UserImageEnt img = new UserImageEnt();
            //string[] userKey = new string[1000];
            //for (int i = 0; i < 1000; i++) {
            //    userKey[i] = StringUtils.GetRandomString(15);
            //}
            //Random rd = new Random();
            //for (int j = 0; j < 1000000; j++) {
            //    int index = rd.Next(0, 1000);
            //    img.UserKey = userKey[index];
            //    img.FileName = img.UserKey + (j + 1).ToString();
            //    _objImage.Insert(img);
            //    Console.WriteLine("item: " + j);
            //    System.Threading.Thread.Sleep(10);
            //}

            //List<CityEnt> lst = _objectCity.GetAll();
            //DateTime d = ConvertUtils.ToDateTime("7/11/2010", "d/M/yyyy");
            //item = _objectUser.GetByUserKey("AmWw51Clq2pCxfc");
            //item = _objectUserAdmin.GetByUserKey("AmWw51Clq2pCxfc");
            //long count = _objectUserAdmin.CountActivedUser();

            //UserLivingProfileEnt lItem = new UserLivingProfileEnt();
            //lItem.UserKey = "chaA8PpNGow6hDG";
            //lItem.Income = 60000000;

            //_objLivingProfile.Insert(lItem);
            //_objLivingProfile.Update(lItem);
            //lItem = _objLivingProfile.GetByUserKey("chaA8PpNGow6hDG");

            //UserFamilyProfileEnt fItem = new UserFamilyProfileEnt();
            //fItem.UserKey = "chaA8PpNGow6hDG";
            //fItem.HasChild = true;
            //_objFamilyProfile.Insert(fItem);
            //_objFamilyProfile.Update(fItem);
            //fItem = _objFamilyProfile.GetByUserKey("chaA8PpNGow6hDG");

            //UserCultureProfileEnt cItem = new UserCultureProfileEnt();
            //cItem.UserKey = "chaA8PpNGow6hDG";
            //cItem.ZodiacMonthID = 12;
            //_objCultureProfile.Insert(cItem);
            //cItem.ReligionID = 1;
            //_objCultureProfile.Update(cItem);
            //cItem = _objCultureProfile.GetByUserKey("chaA8PpNGow6hDG");

            //_objReligion.GetAll();
            //long totalRecords;
            //List<UserEnt> result = _objectUserAdmin.GetWithPaging(1, 10, out totalRecords);

            //long result = _objectGeneralProfileAdmin.CountFemaleUser();
            //result = _objectGeneralProfileAdmin.CountMaleUser();
            //result = _objectGeneralProfileAdmin.CountByAgeRange(14, 26);

            //UserAvatarEnt avItem = new UserAvatarEnt();
            //avItem.UserKey = "chaA8PpNGow6hDG";
            //avItem.Status = EUserAvatarStatus.Available;
            //avItem.FileName = "dadcajpg";
            //_objectAvatar.Update(avItem);
            //_objectAvatar.UpdateStatus(avItem);


            //UserImageEnt imageEnt = new UserImageEnt();

            //imageEnt.ID = 45;
            //imageEnt.UserKey = "o7DvhS5coLjDbqd";
            //imageEnt.FileName = "dadwada";
            //imageEnt.ThumbFileName = "dadwada";
            //imageEnt.Description = "dadsadwad";
            //imageEnt.DateCreated = DateTime.Now;

            //_objUserImage.Delete(45, "o7DvhS5coLjDbqd");
            //_objUserImage.Insert(imageEnt);

            //EUserMessageStatus status = EUserMessageStatus.UnRead;
            //status = status | EUserMessageStatus.UnRead;
            //status = status | EUserMessageStatus.Read;
            //status = status | EUserMessageStatus.UnRead;
            //status = status | EUserMessageStatus.Read;

            //UserMessageEnt msgItem = new UserMessageEnt();
            //msgItem.ConversationID = 3;
            //msgItem.SentUserKey = "sXZnDSH8Lp3HJtR";
            //msgItem.ReceivedUserKey = "ExiDcmIYY8l8gSp";
            //msgItem.Title = "hello thang Chuong";
            //msgItem.Content = "thang Chuong gia dau rui";
            //msgItem.Type = EUserMessageType.User;

            //UserMessageEnt msgItem2 = new UserMessageEnt();
            //msgItem2.ConversationID = 3;
            //msgItem2.SentUserKey = "ExiDcmIYY8l8gSp";
            //msgItem2.ReceivedUserKey = "sXZnDSH8Lp3HJtR";
            //msgItem2.Content = "thang Chuong gia day ne";

            //for (int i = 0; i < 10; i++) {
                //msgItem.SentUserKey = "sXZnDSH8Lp3HJtR";
                //msgItem.ReceivedUserKey = "ExiDcmIYY8l8gSp";
                //msgItem.Title = "Conversation " + i;
                //msgItem.Content = "First Message";
                //_objectMessage.InsertConversation(msgItem);
                //msgItem.Content = ""
                //_objectMessage.InsertMessage(msgItem);
                //_objectMessage.InsertMessage(msgItem2);
            //}
            //List<UserMessageEnt> 

            //for (int i = 500; i < 650; i++) {
            //    msgItem.ID = i;
            //    _objectMessage.SetRead(msgItem);
            //}

            //for (int i = 2; i <= 101; i++) {
            //    _objectMessage.DeleteForSender("chaA8PpNGow6hDG", 2);
            //}

            //UserMessageEnt msg2 = _objectMessage.GetByUserKeyAndID("o7DvhS5coLjDbqd", 156, EUserMesasgeWay.Receiver);
            //int total = 0;
            //List<UserMessageEnt> res = _objectMessage.GetConversationMessages("ExiDcmIYY8l8gSp", 3);
            //_objectMessage.DeleteConversation("ExiDcmIYY8l8gSp", 3);
            //List<UserMessageEnt> res = _objectMessage.GetAllConversationWithPaging("jHIIN6t48Kvm4Cf", 1, 5, out total);
            //List<UserMessageEnt> res = _objectMessage.GetUnReadConversationWithPaging("ExiDcmIYY8l8gSp", 1, 5, out total);
            //_objectMessage.DeleteAllBetween("chaA8PpNGow6hDG", "o7DvhS5coLjDbqd", DateTime.Now, EUserMesasgeWay.Sender);
            //List<UserMessageEnt> res = _objectMessage.GetAllBetween("o7DvhS5coLjDbqd", "chaA8PpNGow6hDG");
            //bool res = _objectMessage.CheckUser1CanSendMessageToUser2("sXZnDSH8Lp3HJtR", "ExiDcmIYY8l8gSp");
            //short i = ConvertUtils.ToShort("dada");

            //string temp = "ân oán điên cuồng, ăn năn chuộc án";
            //TextInfo info = CultureInfo.CurrentCulture.TextInfo;
            //string temp2 = info.ToTitleCase(temp);

            //long userCount = UserMessageNotificationBC.GetUserCount();
            //DateTime currentTime = DateTime.Now;
            //int blockCount = (int)(userCount / 1000);
            //if (userCount % 1000 != 0) {
            //    blockCount++;
            //}
            //List<UserMessageNotificationEnt> block = null;
            //int startID = 1;
            //int endID = 1000;
            //DateTime startTime = new DateTime(currentTime.Year, currentTime.Month, currentTime.Day, 0, 0, 0);
            //DateTime endTime = new DateTime(currentTime.Year, currentTime.Month, currentTime.Day, 23, 59, 59);
            //for (int i = 1; i <= blockCount; i++) {
            //    block = UserMessageNotificationBC.GetFromIdToId(startID, endID, startTime, endTime);
            //    if (block != null && block.Count > 0) {
            //        for (int j = 0; j < block.Count; j++) {
            //            if (block[i].MessagesInDay > 0) {
            //                Console.WriteLine("{0}: {1}", block[j].UserKey, block[j].MessagesInDay);
            //            }
            //            else {
            //                Console.WriteLine("{0}: 0", block[j].UserKey);
            //            }
            //        }
            //    }
            //    startID += 1000;
            //    endID += 1000;
            //    System.Threading.Thread.Sleep(500);
            //}

            //DateTime startTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1, 0, 0, 0);
            //DateTime endTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1, 23, 59, 59);
            //List<UserMessageNotificationEnt> result = UserMessageNotificationBC.GetAll(startTime, endTime);

            //UserFollowerEnt foItem = new UserFollowerEnt();
            //foItem.FollowerUserKey = "ExiDcmIYY8l8gSp";
            //foItem.FollowedUserKey = "sXZnDSH8Lp3HJtR";
            //foItem.FollowedUserKey = "BHQVNT5Ey7o3pAh";
            //foItem.FollowedUserKey = "2SkmtoDK2dNnzpT";

            //foItem.FollowerUserKey = "sXZnDSH8Lp3HJtR";
            //foItem.FollowerUserKey = "BHQVNT5Ey7o3pAh";
            //foItem.FollowerUserKey = "2SkmtoDK2dNnzpT";
            //foItem.FollowerUserKey = "PTMMNnhpnhwfFz7";
            //foItem.FollowerUserKey = "CrjsTyBQswosnEY";
            //foItem.FollowerUserKey = "xggEm6CJVMq0pIY";
            //foItem.FollowedUserKey = "ExiDcmIYY8l8gSp";
            //_objUserFollower.Insert(foItem);
            //_objUserFollower.Delete(foItem.FollowerUserKey, foItem.FollowedUserKey);
            //List<UserFollowerEnt> result = _objUserFollower.GetByFollowerUserKey("ExiDcmIYY8l8gSp");
            //int totalRecord = 0;
            //List<UserFollowerEnt> result = _objUserFollower.GetByFollowedUserKeyWithPaging("ExiDcmIYY8l8gSp", 1, 5, out totalRecord);
            //totalRecord = _objUserFollower.CountFollowerUserKey("ExiDcmIYY8l8gSp");

            //_objectMessageAdmin.GetAllWithPaging(1, 10, out totalRecord);

            //NoelEventBC.Insert(new NoelEventEnt() { UserKey = "ExiDcmIYY8l8gSp", GoOut = true });
            //NoelEventBC.Update(new NoelEventEnt() { UserKey = "ExiDcmIYY8l8gSp", GoOut = false, ChosenDate = "23,24,25", NeedFriend = true });
            // 

            //_objPropertyCategoryAdmin.Insert(new PropertyCategoryEnt() { Name = "Tình yêu", Ordering = 1, Status = EPropertyCategoryStatus.Show, DateCreated = DateTime.Now });
            //_objPropertyCategoryAdmin.Update(new PropertyCategoryEnt() { ID = 2, Name = "Valentine - Lễ tình nhân", Status = EPropertyCategoryStatus.Show });
            //_objPropertyCategory.GetShowedList();
            //_objPropertyCategoryAdmin.UpdateOrdering(new List<PropertyCategoryEnt>() { new PropertyCategoryEnt() { ID = 1, Ordering = 1 }, new PropertyCategoryEnt() { ID = 2, Ordering = 2 } });

            //_objPropertyAdmin.Insert(new PropertyEnt() { Name = "Gấu bông tình yêu", FileName = "gaubong.gif", PropertyCategoryID = 1, PointPrice = 100, PaymentMethods = EPropertyPaymentMethod.Point, DateCreated = DateTime.Now, DateModified = DateTime.Now, Status = EPropertyStatus.Show });
            //_objPropertyAdmin.Update(new PropertyEnt() { ID = 1, Name = "Gấu bông tình yêu valentine", FileName = "gaubong.gif", PropertyCategoryID = 1, PointPrice = 100, PaymentMethods = EPropertyPaymentMethod.Point, DateCreated = DateTime.Now, DateModified = DateTime.Now, Status = EPropertyStatus.Show });
            //int totalRecord = 0 ;
            //_objPropertyAdmin.GetByCategoryIDPaging(1, 1, 10, out totalRecord);

        }


        public List<DateTime> GetDates(DateTime startDate, DateTime endDate, int validDay)
        {
            if (startDate.Day > validDay - 15)
            {
                startDate = startDate.AddMonths(1);
            }

            TimeSpan span;
            span = endDate - startDate;

            List<DateTime> result = new List<DateTime>();

            DateTime dateToParse = DateTime.MinValue + span; // the error points to here

            int yearMonths = 0;
            if (dateToParse.Year > 0)
            {
                yearMonths = (dateToParse.Year - 1) * 12;
            }

            int monthCount = (yearMonths + dateToParse.Month) - 1;

            int lastRow = 0;
            if (endDate.Day > validDay)
            {
                lastRow = (monthCount + 2);
            }
            else if (endDate.Day < validDay)
            {
                lastRow = (monthCount + 1);
            }
            else
            {
                lastRow = monthCount;
            }

            for (int i = 0; i < lastRow; i++)
            {
                DateTime currDate = endDate.AddMonths(-(monthCount - i));
                int lastDayOfMonth = DateTime.DaysInMonth(currDate.Year, currDate.Month);
                currDate = new DateTime(currDate.Year, currDate.Month, lastDayOfMonth);
                if (currDate.Day <= validDay)
                {
                    result.Add(currDate);
                }
                else
                {
                    currDate = new DateTime(currDate.Year, currDate.Month, validDay);
                    result.Add(currDate);
                }
            }

            return result;
        }

    }
}
